////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                                            //
//                                                         WNProject                                                          //
//                                                                                                                            //
//            This file is distributed under the BSD 2-Clause open source license. See License.txt for details.               //
//                                                                                                                            //
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

#ifndef __WN_PARSE_NODE_H__
#define __WN_PARSE_NODE_H__

#include "WNCore/inc/WNTypes.h"
#include "WNScripting/inc/WNScriptingConfig.h"
#include "WNScripting/inc/WNScopedVariableList.h"
#include "WNScripting/inc/WNScriptingEngineData.h"
#include "WNScripting/inc/WNTypeManager.h"

namespace llvm {
    class Value;
};

struct WNFunctionDecl;

class WNParseNode {
public:
    WNParseNode(WN_SIZE_T _startLine, WN_SIZE_T _endLine, WN_SIZE_T _startChar, WN_SIZE_T _endChar);
    virtual ~WNParseNode();

    virtual llvm::Value* OptimizeAndGenerate(WNScriptingEngineData& _scriptingData, WNFunctionDecl* _functionDecl);
    //TODO: Send down stream, or function pointer, so that errors can be written (rather than just dumping to stderr)
    virtual WN_BOOL ReportErrors();

    WN_SIZE_T mStartLine;
    WN_SIZE_T mEndLine;
    WN_SIZE_T mStartChar;
    WN_SIZE_T mEndChar;

protected:
    WN_BOOL mOptimized;
    WN_BOOL mGenerated;
    const WN_CHAR* mFail;
    const WN_CHAR* mWarning;
};


#endif // __WN_PARSE_NODE_H__